Repository navigation
fix(stubgen): clean read-only staged files after failure - #4974
Merged
adriadam10 merged 1 commit intoOct 14, 2026
Merged
Conversation
ideabsassistenza
force-pushed
the
fix/stubgen-readonly-cleanup
branch
from
October 13, 2026 07:48
4d4f6a9 to
149aea5
Compare
Contributor
|
Windows test: head AI-assisted (Claude Code). |
Collaborator
|
Checked the cleanup change in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On Windows, a staged stub-generator file inherits a read-only destination's mode. If a later output cannot be staged or replacement is denied, cleanup cannot unlink that temporary file. It leaves the file behind and its
PermissionErrormasks the original failure.When temporary-file removal is denied, make that staged file writable and retry removal. The existing destination keeps its contents and read-only mode. Generated code, output permissions and the successful write path remain unchanged.
Tested
Windows, CPython 3.12.14, based on
mainata373241de4403f7e8272be09ccf1a6b0866a8c69; tested commit149aea506152466d0f0befa14c747105ab29f810:tools/stubgen.pyand pass with the fix. One verifies the original missing-directory diagnostic and temporary cleanup; the other verifies cleanup after Windows denies replacing a read-only destination. Both preserve the original file and its mode.git diff --checkpass.No native runtime code changed. No full native build, CTest or title run was performed. Tests were run directly with Python; the Windows-specific replacement test is skipped on other platforms.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file; no native exports or silent stubs changed.mdfiles or images added to the repository